package com.wdf.rule.validator;

import cn.hutool.core.text.StrFormatter;
import cn.hutool.core.util.NumberUtil;
import com.googlecode.aviator.AviatorEvaluator;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

/**
 * @author wangdingfu
 * @date 2023-11-21 20:47:32
 */
public class ValidatorTest {
    static String template = "AviatorEvaluator.execute(\"{}\", FuAvidatorEvaluator.buildMap(\"{}\", {}))";

    public static void main(String[] args) {
        OrderInfo orderInfo = new OrderInfo();
        orderInfo.setAmount(new BigDecimal("200"));
        orderInfo.setScore(new BigDecimal("4"));
        System.out.println(StrFormatter.format(template,"a.amount*(a.score+6)","a","orderInfo"));
    }
}
